fix(eval): acknowledge sync only after preceding writes complete 🤖🤖🤖 - #282
fix(eval): acknowledge sync only after preceding writes complete 🤖🤖🤖#282Sampoornnagpal wants to merge 2 commits into
Conversation
Signed-off-by: Sampoorn Nagpal <nagpalsampoorn@gmail.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
Included review availability: Your plan provides up to 12 included reviews per hour; 6 remain after this review. 📝 WalkthroughWalkthroughThe headless ingestion worker now uses future barriers, tracks persistence failures, handles cancelled requests, and drains queued work during shutdown. ChangesHeadless synchronization
Estimated code review effort: 3 (Moderate) | ~20 minutes Merge Risk: ⚪ Minimal · up to The headless sync endpoint now waits for earlier persistence work and reports write failures; targeted coverage indicates the intended ordering, failure, cancellation, and shutdown behavior is ready to merge. Sequence Diagram(s)sequenceDiagram
participant SyncClient
participant SyncEndpoint
participant IngestionQueue
participant HeadlessWorker
participant PersistenceWriter
SyncClient->>SyncEndpoint: POST /v1/sync
SyncEndpoint->>IngestionQueue: enqueue future barrier
HeadlessWorker->>PersistenceWriter: persist preceding batches
PersistenceWriter-->>HeadlessWorker: success or failure
HeadlessWorker-->>SyncEndpoint: resolve barrier status
SyncEndpoint-->>SyncClient: HTTP 200 or HTTP 500
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Signed-off-by: Sampoorn Nagpal <nagpalsampoorn@gmail.com>
What does this PR do?
During batch collection, the headless backend acknowledges a queued
/v1/syncevent before writing the preceding batch. Scorers can receive{"synced": true}while that batch is still blocked and absent from storage.Stop collection at the barrier, write the batch, then resolve the waiting request. Use a future carrying write success so failed batches or payloads skipped by the store return HTTP 500 on subsequent sync requests. Since skipped data cannot be recovered by syncing again, failure remains latched for that backend's lifetime. Cancelled/timed-out callers do not stop the worker. Shutdown also drains in-flight work when the queue is already empty.
Validation
Deterministic tests coordinate blocked writers with events, without timing sleeps. They cover batch limits 1 and 32, later arrivals, exceptions, skipped payloads, and cancelled sync requests. The pre-fix run reproduced premature acknowledgement and false success after a write exception.
uv run pytest -q util/eval_pipeline/tests/test_headless_sync.py tests/tracing/test_journal_routes_match.py— 7 passed. Targeted Pyright: 0 errors/warnings.These exercise the ASGI app with a controlled writer, without a live server/model. Windows/Python 3.12 uses external import-only helpers for #84/#85 (
fcntl/SIGUSR2); these are not included and do not validate POSIX locking/signals.Related issues
Independent of the trace-store connection/transaction changes in #273/#274.
Checklist
Summary by CodeRabbit